package com.mybatiscore.jiaocheng.d02mybatis参数;

import com.mybatiscore.Mapper.StudentMapper;
import com.mybatiscore.POJO.Student;
import com.mybatiscore.Util.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class d03多参数and_param注解 {
    @Test
    public void selectNameSex(){
        SqlSession sqlSession = SqlSessionUtil.openSession();
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        List<Student> students = mapper.selectNameSex("李是", '男');
        for (Student s:students
             ) {
            System.out.println(s);
        }
        sqlSession.close();
    }

    /*
        Param注解：能指定参数的key
     */
    @Test
    public void selectNameSex1(){
        SqlSession sqlSession = SqlSessionUtil.openSession();
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        List<Student> students = mapper.selectNameSex1("李是", '男');
        for (Student s:students
        ) {
            System.out.println(s);
        }
        sqlSession.close();
    }
}
